package com.linln.modules.system.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linln.common.enums.StatusEnum;
import com.linln.common.utils.StatusUtil;
import com.linln.component.excel.annotation.Excel;
import com.linln.component.excel.enums.ExcelType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Data
@Entity
@Table(name = "pcs_company_param")
@ToString(exclude = {"dept", "roles"})
@EqualsAndHashCode(exclude = {"dept", "roles"})
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update pcs_company_param" + StatusUtil.SLICE_DELETE)
@Where(clause = StatusUtil.NOT_DELETE)
@Excel("公司参数")
public class CompanyParam implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Excel(value = "ID", type = ExcelType.EXPORT)
    private Long id;

    @CreatedDate
    @Excel("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    @LastModifiedDate
    @Excel("更新时间")
    private Date updateTime;

    @JsonIgnore
    private Long createUser;

    @JsonIgnore
    private Long updateUser;

    @JsonIgnore
    private Byte status = StatusEnum.OK.getCode();

    private String mchId;//mchId

    private String apiKey;//apiKey

    private String keyPath;//证书路径

    private long companyId;

    private String mchNumber;//商户证书序列号

    private String privateKey; //商户私钥（字符串形式）
    private String payErw; //静态收款码
}
